package com;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.oas.annotations.EnableOpenApi;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configurable
@EnableOpenApi
public class RearConfig implements WebMvcConfigurer{

    @Bean
    public Docket applicationApi(){
        return new Docket(DocumentationType.SWAGGER_2)
                .enable(true)
                .select()
                .apis(RequestHandlerSelectors.basePackage("tianqi.controller"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(myapiInfo());
    }
    private ApiInfo myapiInfo(){
        return new ApiInfoBuilder().title("数据接口对准的标题进行描述")
                .contact(new Contact("","",""))
                .version("1.0")
                .description("数据接口测试")
                .build();
    }
}